VERSION 5.00
Object = "{8E27C92E-1264-101C-8A2F-040224009C02}#7.0#0"; "MSCAL.OCX"
Begin VB.Form frmIPDAdd 
   BackColor       =   &H00FFFFFF&
   Caption         =   "IPD Create Shipment"
   ClientHeight    =   6810
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6060
   Icon            =   "frmIPDAdd.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   6810
   ScaleWidth      =   6060
   StartUpPosition =   1  'CenterOwner
   Begin VB.Timer timerAutoOpen 
      Enabled         =   0   'False
      Interval        =   200
      Left            =   4920
      Top             =   6360
   End
   Begin VB.TextBox f1358 
      Height          =   315
      Left            =   2460
      TabIndex        =   34
      Top             =   5880
      Width           =   2955
   End
   Begin VB.ComboBox cbo1358 
      Height          =   315
      ItemData        =   "frmIPDAdd.frx":1272
      Left            =   2460
      List            =   "frmIPDAdd.frx":1274
      TabIndex        =   33
      Top             =   5880
      Width           =   2955
   End
   Begin VB.OptionButton opt1358 
      BackColor       =   &H00FFFFFF&
      Caption         =   "FTR Exemption"
      Height          =   315
      Index           =   0
      Left            =   1380
      TabIndex        =   32
      Top             =   5520
      Width           =   1455
   End
   Begin VB.OptionButton opt1358 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Citation Type"
      Height          =   315
      Index           =   1
      Left            =   3000
      TabIndex        =   31
      Top             =   5520
      Width           =   1455
   End
   Begin VB.CheckBox f1592 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Enter Total Customs Value by Shipment"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1800
      TabIndex        =   11
      Top             =   4080
      Width           =   3735
   End
   Begin VB.TextBox f79 
      Height          =   315
      Left            =   2460
      TabIndex        =   13
      Top             =   4740
      Width           =   2955
   End
   Begin VB.TextBox f119 
      Height          =   315
      Left            =   2460
      TabIndex        =   12
      Top             =   4380
      Width           =   2955
   End
   Begin MSACAL.Calendar Calendar1 
      Height          =   255
      Left            =   2460
      TabIndex        =   26
      TabStop         =   0   'False
      Top             =   420
      Visible         =   0   'False
      Width           =   255
      _Version        =   524288
      _ExtentX        =   450
      _ExtentY        =   450
      _StockProps     =   1
      BackColor       =   16777215
      Year            =   2004
      Month           =   2
      Day             =   9
      DayLength       =   1
      MonthLength     =   2
      DayFontColor    =   0
      FirstDay        =   1
      GridCellEffect  =   1
      GridFontColor   =   10485760
      GridLinesColor  =   -2147483632
      ShowDateSelectors=   -1  'True
      ShowDays        =   -1  'True
      ShowHorizontalGrid=   -1  'True
      ShowTitle       =   0   'False
      ShowVerticalGrid=   -1  'True
      TitleFontColor  =   10485760
      ValueIsNull     =   -1  'True
      BeginProperty DayFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty GridFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty TitleFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   12.01
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.ComboBox f1355 
      Height          =   315
      Left            =   2880
      TabIndex        =   1
      Top             =   780
      Width           =   2535
   End
   Begin VB.ComboBox f72 
      Height          =   315
      ItemData        =   "frmIPDAdd.frx":1276
      Left            =   2460
      List            =   "frmIPDAdd.frx":128C
      TabIndex        =   9
      Top             =   3300
      Width           =   2955
   End
   Begin VB.TextBox f24 
      Height          =   315
      Left            =   2460
      TabIndex        =   0
      Top             =   420
      Width           =   1035
   End
   Begin VB.CommandButton cmdContinue 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "C&ontinue"
      Height          =   315
      Left            =   1500
      MaskColor       =   &H00E0E0E0&
      Style           =   1  'Graphical
      TabIndex        =   14
      Top             =   6360
      Width           =   1215
   End
   Begin VB.CommandButton cmdCancel 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Cancel          =   -1  'True
      Caption         =   "&Cancel"
      Height          =   315
      Left            =   3300
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   15
      Top             =   6360
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.TextBox f1297 
      BackColor       =   &H00FFFFFF&
      Height          =   315
      Left            =   2460
      TabIndex        =   2
      Top             =   1140
      Width           =   2955
   End
   Begin VB.ComboBox f75 
      Height          =   315
      ItemData        =   "frmIPDAdd.frx":136C
      Left            =   2460
      List            =   "frmIPDAdd.frx":1376
      TabIndex        =   10
      Top             =   3660
      Width           =   735
   End
   Begin VB.ComboBox f70 
      Height          =   315
      ItemData        =   "frmIPDAdd.frx":1384
      Left            =   2460
      List            =   "frmIPDAdd.frx":138E
      TabIndex        =   7
      Top             =   2580
      Width           =   2955
   End
   Begin VB.TextBox f71 
      Height          =   315
      Left            =   2460
      TabIndex        =   8
      Top             =   2940
      Width           =   2955
   End
   Begin VB.ComboBox f68 
      Height          =   315
      ItemData        =   "frmIPDAdd.frx":13BA
      Left            =   4740
      List            =   "frmIPDAdd.frx":13BC
      TabIndex        =   6
      Top             =   2220
      Width           =   675
   End
   Begin VB.ComboBox f50 
      Height          =   315
      Left            =   2460
      TabIndex        =   3
      Top             =   1500
      Width           =   2955
   End
   Begin VB.TextBox f20 
      Height          =   315
      Left            =   2460
      TabIndex        =   5
      Top             =   2220
      Width           =   2055
   End
   Begin VB.ComboBox f23 
      Height          =   315
      ItemData        =   "frmIPDAdd.frx":13BE
      Left            =   2460
      List            =   "frmIPDAdd.frx":13C8
      TabIndex        =   4
      Top             =   1860
      Width           =   2955
   End
   Begin VB.Line Line1 
      BorderColor     =   &H000080FF&
      BorderWidth     =   2
      Index           =   9
      X1              =   360
      X2              =   5580
      Y1              =   5220
      Y2              =   5220
   End
   Begin VB.Label Label81 
      BackColor       =   &H00FFFFFF&
      Caption         =   "SED/EEI Information"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   255
      Left            =   360
      TabIndex        =   36
      Top             =   5235
      Width           =   2775
   End
   Begin VB.Label lbl1358 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "AES Citation:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   840
      TabIndex        =   35
      Top             =   5940
      Width           =   1515
   End
   Begin VB.Label lbl79 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Commodity Summary:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   30
      Top             =   4800
      Width           =   2115
   End
   Begin VB.Label lbl119 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Total Customs Value:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   29
      Top             =   4440
      Width           =   2115
   End
   Begin VB.Label lblCommodity 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Terms of Sale:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   540
      TabIndex        =   28
      Top             =   3360
      Width           =   1815
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFFFFF&
      Caption         =   "IPD-"
      Height          =   195
      Left            =   2460
      TabIndex        =   27
      Top             =   840
      Width           =   375
   End
   Begin VB.Image Image1 
      Height          =   345
      Left            =   3600
      Picture         =   "frmIPDAdd.frx":13F4
      Stretch         =   -1  'True
      Top             =   420
      Width           =   345
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Ship Date:"
      Height          =   255
      Index           =   44
      Left            =   1500
      TabIndex        =   25
      Top             =   480
      Width           =   855
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Weight Type:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   3
      Left            =   600
      TabIndex        =   24
      Top             =   3720
      Width           =   1755
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "IOR Facility Code:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   600
      TabIndex        =   23
      Top             =   840
      Width           =   1755
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Invoice Number:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   900
      TabIndex        =   22
      Top             =   1200
      Width           =   1455
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Duty/Tax Pay Type:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   23
      Left            =   420
      TabIndex        =   21
      Top             =   2640
      Width           =   1935
   End
   Begin VB.Label lblf20 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Duty/Tax Account #:"
      Height          =   255
      Index           =   1
      Left            =   780
      TabIndex        =   20
      Top             =   3000
      Width           =   1575
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Recipient Country:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   2
      Left            =   600
      TabIndex        =   19
      Top             =   1560
      Width           =   1755
   End
   Begin VB.Label Label9 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Shipment Information"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   255
      Left            =   420
      TabIndex        =   18
      Top             =   135
      Width           =   2055
   End
   Begin VB.Line Line1 
      BorderColor     =   &H000080FF&
      BorderWidth     =   2
      Index           =   0
      X1              =   360
      X2              =   5580
      Y1              =   120
      Y2              =   120
   End
   Begin VB.Label lblf20 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Bill-to Account #:"
      Height          =   255
      Index           =   0
      Left            =   780
      TabIndex        =   17
      Top             =   2280
      Width           =   1575
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Bill Shipment to:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   19
      Left            =   900
      TabIndex        =   16
      Top             =   1920
      Width           =   1455
   End
End
Attribute VB_Name = "frmIPDAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Dim m_dtTDDate As Date
Dim dtIPDAdd As Date

Public Sub AutoOpen(dtTDDate As Date)

'    Me.Show 0, g_frmTD
'    m_dtTDDate = dtTDDate
'    f24 = dtTDDate
'    Me.Show 0
'    timerAutoOpen.Enabled = True
    
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdCancel_Click()
' DateTime  : 10/25/2004
' Purpose   : Set boolean to False, unload form and show IPD form
'---------------------------------------------------------------------------------------
'
Private Sub cmdCancel_Click()
    On Error Resume Next
    g_blnIPDConfirm = False
    Unload Me
    Set g_frmIPDAdd = Nothing
    g_frmIPD.SetFocus
End Sub
'---------------------------------------------------------------------------------------
' Procedure : cmdContinue_Click()
' DateTime  : 10/25/2004
' Purpose   : Assigns values to globals vars then builds and sends Create transaction.
'---------------------------------------------------------------------------------------
'
Private Sub cmdContinue_Click()
    
    Call AssignFormGlobalVars
    
    If g_blnIPDConfirm Then
        Call SendData(BuildIPDConfirmTrans)
    Else
        Call SendData(BuildIPDCreateTrans)
    End If

End Sub
'---------------------------------------------------------------------------------------
' Procedure : AssignFormGlobalVars()
' DateTime  : 4/26/2006
' Purpose   : Assign the form's global vars
'---------------------------------------------------------------------------------------
'
Public Sub AssignFormGlobalVars()
    
    g_str24 = f24
    g_str1297 = f1297
    g_str1355 = "IPD-" & f1355
    g_str50 = Left(f50, 2)
    g_str23 = Left(f23, 1)
    g_str20 = f20
    g_str68 = f68
    g_str70 = Left(f70, 1)
    g_str71 = f71
    g_str72 = Left(f72, 1)
    g_str75 = f75
    
    '03/01/06 updated for new SED/EEI Implementation
    If g_str117 = "US" Then
        g_str1358 = IIf(opt1358(0) And cbo1358 <> "[Please Select]", cbo1358, f1358)  'FTR Exemption # or AES Citation #
    Else
        g_str118 = f1358                            'IRS/EIN/VAT #
    End If
    
    g_blnIPD = True
    
    If f1592 Then
        g_str1592 = "Y"
        g_str119 = f119
        g_str79 = f79
    Else
        g_str1592 = ""
        g_str119 = ""
        g_str79 = ""
    End If

End Sub
'---------------------------------------------------------------------------------------
' Procedure : f119_Change()
' DateTime  : 3/18/2005
' Purpose   : If it a confirm and Customs Val is blank set background to orange
'---------------------------------------------------------------------------------------
'
Private Sub f119_Change()
    If g_blnIPDConfirm Then
        Call SetEmptyBackcolor(f119)
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f1355_Click()
' DateTime  : 3/18/2005
' Purpose   : Load IOR details for code in f1355.
'---------------------------------------------------------------------------------------
'
Private Sub f1355_Click()

    Call LoadIORAddForm(f1355)
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f1358_Change()
' DateTime  : 3/18/2005
' Purpose   : If it a confirm and ITN/FTSR is blank set background to orange
'---------------------------------------------------------------------------------------
'
Private Sub f1358_Change()
    If g_blnIPDConfirm Then
        Call SetEmptyBackcolor(f1358)
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f50_Change()
' DateTime  : 10/25/2004
' Purpose   : Calls a routine to populate the entire text of country.
'---------------------------------------------------------------------------------------
'
Private Sub f50_Change()
    If Len(f50) >= 2 Then
        Call SetComboSelection(f50, f50)
    End If
End Sub

'---------------------------------------------------------------------------------------
' Procedure : f72_Change()
' DateTime  : 10/25/2004
' Purpose   : Calls a routine to populate the entire text of Terms of Sale.
'---------------------------------------------------------------------------------------
'
Private Sub f72_Change()
    If Len(f72) >= 1 Then
        Call SetComboSelection(f72, f72)
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f79_Change()
' DateTime  : 3/18/2005
' Purpose   : If it a confirm and Commod Summary is blank set background to orange
'---------------------------------------------------------------------------------------
'
Private Sub f79_Change()
    If g_blnIPDConfirm Then
        Call SetEmptyBackcolor(f79)
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_Activate()
' DateTime  : 3/18/2005
' Purpose   : Set form layout for Add or Confirm
'---------------------------------------------------------------------------------------
'
Private Sub Form_Activate()
    
    Dim strTempIOR As String
    
    Call LoadIORCombo
    
    f1355.SetFocus
    
    'Confirm
    If g_blnIPDConfirm Then
        'Get IOR code from frmIPD
        strTempIOR = Right(g_frmIPD.grdIPD.Columns("IOR Facility"), Len(g_frmIPD.grdIPD.Columns("IOR Facility")) - 4)
        f1355 = strTempIOR
        'Load IOR info on form
        Call LoadIORAddForm(strTempIOR)
        'Disable checkbox on Confirm
        f1592.Enabled = False
        'If Enter Total Customs Val checkbox is selected enable and show
        'Customs Val and Commod Summary fields
        If f1592 = 1 Then
            lbl119.Enabled = True
            f119.Enabled = True
            lbl79.Enabled = True
            f79.Enabled = True
        End If
    'Add
    Else
        'Set focus to Customer Inv #
        'If FedEx is creating CCI, customer cannot enter Customs Value by Shipment
        f1592.Enabled = IIf(frmSetup.f113, False, True)
        'Load IOR info on form
        Call LoadIORAddForm(f1355)
        ''Disable Customs Val and Commod Summary fields
        lbl119.Enabled = False
        f119.Enabled = False
        lbl79.Enabled = False
        f79.Enabled = False
    End If
    
    Call Initialize(Me)
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_KeyDown()
' DateTime  : 2/17/2005
' Purpose   : Enter key pressed sends a TAB to move to next field
'---------------------------------------------------------------------------------------
'
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If Not TypeOf Me.ActiveControl Is CommandButton Then
        If Shift = 0 And KeyCode = 13 Then
            SendKeys "{TAB}"
        End If
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_Load()
' DateTime  : 10/25/2004
' Purpose   : Initial form settings...
'---------------------------------------------------------------------------------------
'
Private Sub Form_Load()
    Call LoadCountries(f50)
    Call LoadCurrencies(f68)
   
   '02/07/06 Load FTR Exemptions
    Call LoadFTRExemptions(cbo1358)

    opt1358(0) = 1
    
    f23.ListIndex = 0
    f70.ListIndex = 0
    
    With frmShip
        f50 = IIf(Left(.f50, 2) <> "US", Left(.f50, 2), "AD")
    End With
    f72.ListIndex = 0
    
    '01/16/06 Added currency codes for CA and MX
    If g_str117 = "CA" Then
        f68 = "CAD"
    ElseIf g_str117 = "MX" Then
        f68 = "NMP"
    Else
        f68 = "USD"
    End If
        
    f75 = "LBS"
    f24.Text = Date
    Calendar1.Today
    Calendar1.Height = 2295 'Ship date - Ship Tab
    Calendar1.Width = 3015
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f23_Change()
' DateTime  : 10/25/2004
' Purpose   : Calls a routine to populate the entire text of selected payment type.
'---------------------------------------------------------------------------------------
'
Private Sub f23_Change()
    If Len(f23) >= 1 Then
        Call SetComboSelection(f23, f23)
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f23_Click()
' DateTime  : 3/16/2004
' Purpose   : Billing Type if 2 or 3 are selected highlight Billing Acct# field, and
'             set focus to it, else disable acct# field.
'---------------------------------------------------------------------------------------
'
Private Sub f23_Click()
    On Error GoTo EH
    
    If Left(f23, 1) <> "1" Then
        f20.Enabled = True
        If Len(f20) = 0 Then
            f20.BackColor = &HC0E0FF
            f20.SetFocus
        End If
    Else
        f20.Enabled = False
        f20 = ""
        f20.BackColor = &HFFFFFF
    End If
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd:f23_Click"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : f70_Change()
' DateTime  : 10/25/2004
' Purpose   : Calls a routine to populate the entire text of selected payment type.
'---------------------------------------------------------------------------------------
'
Private Sub f70_Change()
    If Len(f70) >= 1 Then
        Call SetComboSelection(f70, f70)
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f70_Click()
' DateTime  : 11/18/2004
' Purpose   : If Bill 3rd party selected for Duty/Taxes payor highlight Duty/taxes acct#
'             field and set focus to it.
'---------------------------------------------------------------------------------------
'
Private Sub f70_Click()
    On Error GoTo EH
    
    Select Case Left(f70, 1)
        Case "1"
            f71.Enabled = False
            f71 = ""
        Case "2"
            f71.Enabled = True
            f71.BackColor = &HFFFFFF
        Case "3"
            f71.Enabled = True
            f71.BackColor = &HC0E0FF
            f71.SetFocus
    End Select
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd:f70_Click"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : f20_Change()
' DateTime  : 10/25/2004
' Purpose   : Acct# is numeric with max length of 9
'---------------------------------------------------------------------------------------
'
Private Sub f20_Change()
    On Error GoTo EH
    
    f20.BackColor = &HFFFFFF
    Call NumericOnly(f20, False)
    Call CheckLength(f20, 9)
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd:f20_Change"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : f20_LostFocus()
' DateTime  : 10/25/2004
' Purpose   : Validate Billing acct# and give error if not valid. If blank, set acct#
'             back to Bill Shipper and set focus on Billing Type field.
'---------------------------------------------------------------------------------------
'
Private Sub f20_LostFocus()
    On Error GoTo EH
    
    If Not AcctNumCheckOK(f20) Then
        f20.BackColor = &HC0E0FF
        If f20 <> "" Then
            MsgBox "Invalid FedEx Account Number", vbExclamation, "Ship Error"
            f20.SetFocus
        End If
    End If
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd:f20_LostFocus"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : f71_Change()
' DateTime  : 10/25/2004
' Purpose   : Acct# is numeric with max length of 9
'---------------------------------------------------------------------------------------
'
Private Sub f71_Change()
    On Error GoTo EH
    
    f71.BackColor = &HFFFFFF
    Call NumericOnly(f71, False)
    Call CheckLength(f71, 9)
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd:f20_Change"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : f71_LostFocus()
' DateTime  : 10/25/2004
' Purpose   : Validate Billing acct# and give error if not valid. If blank, set acct#
'             back to Bill Shipper and set focus on Billing Type field.
'---------------------------------------------------------------------------------------
'
Private Sub f71_LostFocus()
    On Error GoTo EH
    
    If Not AcctNumCheckOK(f71) Then
        If f71 = "" Then
            f71.BackColor = &HFFFFFF
            f71.SetFocus
        Else
            MsgBox "Invalid FedEx Account Number", vbExclamation, "Ship Error"
            f71.BackColor = &HC0E0FF
            f71.SetFocus
        End If
    End If
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd:f20_LostFocus"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : opt1358_Click()
' DateTime  : 2/7/2006
' Purpose   : Enables/disables SED/EEI fields based on the option button clicked.
'---------------------------------------------------------------------------------------
'
Private Sub opt1358_Click(Index As Integer)
    
    On Error GoTo EH
    
    If opt1358(0) Then
        cbo1358.Visible = True
        cbo1358.ListIndex = 0
        f1358.Visible = False
        f1358 = ""
        lbl1358.Caption = "Exemption Type:"
    Else
        cbo1358.Visible = False
        cbo1358.ListIndex = -1
        f1358.Visible = True
        lbl1358.Caption = "AES Citation:"
        
    End If
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd:opt1358_Click"

End Sub
'---------------------------------------------------------------------------------------
' Module    : Image1_Click()
' DateTime  : 10/25/2004
' Author    : Chris Elwell
' Purpose   : Show the ShipDate calendar
'---------------------------------------------------------------------------------------
'
Private Sub Image1_Click()
    Calendar1.Visible = True
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Calendar1_Click()
' DateTime  : 10/25/2004
' Purpose   : Puts date selected on calendar in ShipDate field.
'---------------------------------------------------------------------------------------
'
Private Sub Calendar1_DblClick()
    f24.Text = Calendar1.Value
    Calendar1.Visible = False
End Sub
'---------------------------------------------------------------------------------------
' Procedure : SaveIOR()
' DateTime  : 11/18/2004
' Purpose   : Saves or updates IOR facilities.
'---------------------------------------------------------------------------------------
'
Public Sub SaveIOR()
    On Error GoTo EH
    
    Dim rsIOR As New ADODB.Recordset
    Dim strQuery As String
    
    ' 2014-09-01, JFW, Location doesn't matter, mutli location per account
    strQuery = "SELECT * FROM IOR WHERE f1355 = " & SingleQuotes(f1355) & " And LocationName = " & SingleQuotes(frmShip.cboLocationName(0))
    ' strQuery = "SELECT * FROM IOR WHERE f1355 = " & SingleQuotes(f1355)
    rsIOR.Open strQuery, g_connFSMSClient, adOpenStatic, adLockOptimistic
    
    If rsIOR.EOF Then
        strQuery = "INSERT INTO IOR (f1355, f1297, f1358, f50, f23, f20, f68, f70, f71, f72, f75, f1592, LocationName) "
        strQuery = strQuery + "VALUES ("
        strQuery = strQuery + SingleQuotes(f1355) + ", "
        strQuery = strQuery + SingleQuotes(f1297) + ", "
        strQuery = strQuery + SingleQuotes(f1358) + ", "
        strQuery = strQuery + SingleQuotes(Left(f50, 2)) + ", "
        strQuery = strQuery + SingleQuotes(Left(f23, 1)) + ", "
        strQuery = strQuery + SingleQuotes(f20) + ", "
        strQuery = strQuery + SingleQuotes(f68) + ", "
        strQuery = strQuery + SingleQuotes(Left(f70, 1)) + ", "
        strQuery = strQuery + SingleQuotes(f71) + ", "
        strQuery = strQuery + SingleQuotes(Left(f72, 1)) + ", "
        strQuery = strQuery + SingleQuotes(f75) + ", "
        strQuery = strQuery + Str(f1592) + ", "
        strQuery = strQuery + SingleQuotes(frmShip.cboLocationName(0)) + ")"
        g_connFSMSClient.Execute strQuery
    Else
        strQuery = "UPDATE IOR SET [f1355] = " + SingleQuotes(f1355) + ","
        strQuery = strQuery + "[f1297] = " + SingleQuotes(f1297) + ","
        strQuery = strQuery + "[f1358] = " + SingleQuotes(f1358) + ","
        strQuery = strQuery + "[f50] = " + SingleQuotes(Left(f50, 2)) + ","
        strQuery = strQuery + "[f23] = " + SingleQuotes(Left(f23, 1)) + ","
        strQuery = strQuery + "[f20] = " + SingleQuotes(f20) + ","
        strQuery = strQuery + "[f68] = " + SingleQuotes(f68) + ","
        strQuery = strQuery + "[f70] = " + SingleQuotes(Left(f70, 1)) + ","
        strQuery = strQuery + "[f71] = " + SingleQuotes(f71) + ","
        strQuery = strQuery + "[f72] = " + SingleQuotes(Left(f72, 1)) + ","
        strQuery = strQuery + "[f75] = " + SingleQuotes(f75) + ","
        strQuery = strQuery + "[f1592] = " + Str(f1592)
        strQuery = strQuery + " WHERE f1355 = " + SingleQuotes(f1355)
        ' 2014-09-01, JFW, Location doesn't matter
        strQuery = strQuery + " AND LocationName = " + SingleQuotes(frmShip.cboLocationName(0))
        g_connFSMSClient.Execute strQuery
    End If
    
Release:

    If rsIOR.State = adStateOpen Then
        rsIOR.Close
    End If
    Set rsIOR = Nothing
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd:SaveIOR"
    Resume Release

End Sub
'---------------------------------------------------------------------------------------
' Procedure : LoadIORCombo
' DateTime  : 11/18/2004
' Purpose   : Loads the saved IOR Facilities
' Call from : Form_Activate
'---------------------------------------------------------------------------------------
'
Public Sub LoadIORCombo()
    
    Dim rsIOR As New ADODB.Recordset
    Dim strQuery As String
    
    On Error GoTo EH
    
    strQuery = "SELECT f1355 FROM IOR WHERE LocationName = " & SingleQuotes(frmShip.cboLocationName(0))
    
    rsIOR.Open strQuery, g_connFSMSClient, adOpenStatic, adLockOptimistic
    f1355.Clear
    Do Until rsIOR.EOF
        f1355.AddItem rsIOR.Fields(0)
        rsIOR.MoveNext
    Loop
    f1355.ListIndex = IIf(f1355.ListCount > 0, 0, -1)

Release:
    If rsIOR.State = adStateOpen Then rsIOR.Close
    Set rsIOR = Nothing
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd:LoadIORCombo"
    Resume Release

End Sub

'---------------------------------------------------------------------------------------
' Procedure : LoadIORAddForm()
' DateTime  : 11/18/2004
' Purpose   : Gets IOR info from database and populates IOR Add form fields.
' Call from : f1355_Click(), Form_Activate
'---------------------------------------------------------------------------------------
'
Public Sub LoadIORAddForm(ByVal strIOR As String)

    Dim strQuery As String
    Dim rsIOR As New ADODB.Recordset
    
    On Error GoTo EH
    
    
    strQuery = "SELECT * FROM IOR WHERE f1355 = " & SingleQuotes(strIOR) & " AND LocationName = " + SingleQuotes(frmShip.cboLocationName(0))
    rsIOR.Open strQuery, g_connFSMSClient, adOpenStatic, adLockOptimistic
    
    If Not rsIOR.BOF Or Not rsIOR.EOF Then
        If f1297.Text = "" Then f1297 = rsIOR!f1297
        f50 = rsIOR!f50 & ""
        f23 = rsIOR!f23 & ""
        f20 = rsIOR!f20 & ""
        f68 = rsIOR!f68 & ""
        f70 = rsIOR!f70 & ""
        f71 = rsIOR!f71 & ""
        f72 = rsIOR!f72 & ""
        f75 = rsIOR!f75 & ""
        If g_blnIPDConfirm Then
            f1592 = rsIOR!f1592
            f1358 = rsIOR!f1358
            If f1358 = "" Then
                f1358.BackColor = &HC0E0FF
            End If
            If f1592 = 1 And f119 = "" Then
                f119.BackColor = &HC0E0FF
            End If
            If f1592 = 1 And f79 = "" Then
                f79.BackColor = &HC0E0FF
            End If
        End If
    End If
    
Release:
    If rsIOR.State = adStateOpen Then rsIOR.Close
    Set rsIOR = Nothing
    
    Exit Sub

EH:
    MsgBox Err.Description, vbCritical, "frmIPDAdd.LoadIORAddForm"
    Resume Release
    
End Sub
'---------------------------------------------------------------------------------------
' Module    : GotFocus - textboxes
' DateTime  : 8/29/2005
' Author    : Chris Elwell
' Purpose   : The subroutines below call a routine to select all text in the text box
'             passed to the sub.
'---------------------------------------------------------------------------------------
'
'ShipDate
Private Sub f24_GotFocus()
    Call SelectAllText(f24)
End Sub
'Invoice #
Private Sub f1297_GotFocus()
    Call SelectAllText(f1297)
End Sub
'Bill-to Acct#
Private Sub f20_GotFocus()
    Call SelectAllText(f20)
End Sub
'Duty/Tax Acct#
Private Sub f71_GotFocus()
    Call SelectAllText(f71)
End Sub
'ITN/ITSR/FTSR
Private Sub f1358_GotFocus()
    Call SelectAllText(f1358)
End Sub
'Total Customs Value
Private Sub f119_GotFocus()
    Call SelectAllText(f119)
End Sub
'Summary Description
Private Sub f79_GotFocus()
    Call SelectAllText(f79)
End Sub
'---------------------------------------------------------------------------------------
'End of GotFocus event subs
'---------------------------------------------------------------------------------------

Private Sub timerAutoOpen_Timer()

    On Error GoTo ErrorExit
    
    timerAutoOpen.Enabled = False
    
    If dtIPDAdd < Date Then dtIPDAdd = Now
    
    If DateAdd("s", 15, dtIPDAdd) < Now Then
        Err.Raise 12345, "frmIPDAdd.AutoOpen", "No IPD master shipment"
    End If
    
    If Not Me.Visible Then
        Me.Show
    ElseIf Me.f1355.ListCount > 0 And Me.f1355.ListIndex = -1 Then
        Me.f1355.ListIndex = 0
    Else
        Call cmdContinue_Click
        Exit Sub
    End If
    
    timerAutoOpen.Enabled = True
    Exit Sub
    
ErrorExit:
    g_strErrorLocation = Err.Source & ", " & Err.Description
    frmMsgBox.ShowMessage "Error in AddIPD, " & g_strErrorLocation, 4000
    If False Then
        Resume
    End If
End Sub
